#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
//Ų
int main()
{
	/*int aqui = 0;
	cin >> aqui;
	while (aqui--)*/
	{
		string num;
		cin >> num;
		int i = 0;
		int len = num.length();
		long long a, b, c, d,e,ans=0,ans1=0,ans2=0,key=0;
		for (i = 2; i < len - 2; i++)
		{
			c = num[i] - '0';
			d = num[i + 1] - '0';
			a = num[0] - '0';
			b = stoll(num.substr(1, i - 1));
			e = stoll(num.substr(i + 2));
            if(e==0)
            {
                break;
            }
			ans1 = a + b - c * d / e;
			a = stoll(num.substr(0, i - 1));
			b = num[i - 1] - '0';
			ans2 = a + b - c * d / e;
			ans = max(ans1, ans2);
			key = max(key, ans);
		}
		cout << key << endl;
	}
	return 0;
}